lock = 0
function OnEvent(event, arg)
    if (event == "PROFILE_ACTIVATED") then
        EnablePrimaryMouseButtonEvents(true)
    end
    if (event == "MOUSE_BUTTON_PRESSED" and arg == 4) then
        OutputLogMessage("开启\n")
        lock = 1
    end
    if (event == "MOUSE_BUTTON_PRESSED" and arg == 5) then
        OutputLogMessage("关闭\n")
        lock = 0
    end
    --***********************************************************
    --***********************************************************    --***********************************************************
    if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and lock == 1) then
        while true do
            PressMacro("LeftClickMacro")
            MoveMouseRelative(0, 10)  -- 鼠标向下移动 10 个单位
            if (not IsMouseButtonPressed(1) or lock == 0) then
                ReleaseMacro("LeftClickMacro")
                OutputLogMessage("退出啦\n")
                break
            end
            Sleep(2)
        end
        OutputLogMessage("结束\n")
    end
end
